package com.flex.business
{
	import com.adobe.cairngorm.business.Responder;
	import com.adobe.cairngorm.business.ServiceLocator;
	import com.flex.model.ModelLocatorI;
	
	import mx.rpc.AsyncToken;

	public class ModelServiceDelegate
	{
		public function ModelServiceDelegate( responder:Responder )
		{
			this.responder = responder;
			this.service = ServiceLocator.getInstance().getService( "modelService" );
			this.service.channelSet = ModelLocatorI.getInstance().channelSet;
		}
		
		public function getModelList():void
		{		
			
			var token : AsyncToken=service.getModels();
			token.resultHandler = responder.onResult;
			token.faultHandler = responder.onFault;	
		}
		
		
		public function updateModel(obj:Object):void
		{			
			var token : AsyncToken=service.updateFlexModel(obj);
			token.resultHandler = responder.onResult;
			token.faultHandler = responder.onFault;	
		}
		
		private var responder:Responder;
		private var service : Object;
	}
}